unit upasCashDrawerGUI;
{$I LogOption.txt}

interface

uses
  Windows,
  Messages,
  SysUtils,
  Variants,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  StdCtrls,
  OposCash;

type
  TupasCashDrawerForm = class(TForm)
    CheckBox1: TCheckBox;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
    FEmulator: Boolean;

    procedure setEmulator(Value: Boolean);

  public
    { Public declarations }
    property Emulator: Boolean read FEmulator write setEmulator;

    procedure doDirectIOEvent(ASender: TObject; EventNumber: Integer; var pData: Integer; var pString: WideString);
    procedure doStatusUpdateEvent(ASender: TObject; Data: Integer);

  end;

var
  upasCashDrawerForm: TupasCashDrawerForm;

implementation
{$IFDEF LOGUNITTEST}
uses
  AuditLog;
{$ENDIF}

{$R *.dfm}

procedure TupasCashDrawerForm.setEmulator(Value: Boolean);
begin
  FEmulator := Value;

  CheckBox1.Enabled := FEmulator;
end;

procedure TupasCashDrawerForm.doDirectIOEvent(ASender: TObject; EventNumber: Integer; var pData: Integer; var pString: WideString);
begin
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, TupasCashDrawerForm.ClassName + '.doDirectIOEvent', 'EventNumber="' + IntToStr(EventNumber) + '"');
  {$ENDIF}

end;

procedure TupasCashDrawerForm.doStatusUpdateEvent(ASender: TObject; Data: Integer);
begin
  {$IFDEF LOGUNITTEST}
  AuditLog.EventLog(AuditLog.etDUNIT, TupasCashDrawerForm.ClassName + '.doStatusUpdateEvent', 'Data="' + IntToStr(Data) + '"');
  {$ENDIF}

  if Data = oposcash.CASH_SUE_DRAWERCLOSED then
    CheckBox1.Checked := False
  else if Data = oposcash.CASH_SUE_DRAWEROPEN then
    CheckBox1.Checked := True;
end;

procedure TupasCashDrawerForm.CheckBox1Click(Sender: TObject);
begin
  if CheckBox1.Checked then begin
  end
  else begin
  end;
end;

end.
